import {
	SiupoSlipPrinter,
	PosPrinter,
	CK80Printer
} from '@api/tools/Hardware.js'
import {
	MessageBox
} from "element-ui";
import moment from "moment";
export class Printerconf {
	constructor() {
		this.pk80 = new k80print();
		this.psiupo = new Siupoprint();
		this.ppos = new Posprint();
	}
	//printermodel打印机型号 val为this printdata为打印内容
	async zzfkprint(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.zzfkprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.zzfkprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.zzfkprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}
	//门诊预约打印
	async mzyyprint(printermodel, val, printdata) {
		console.log(printermodel, 'printermodel')
		console.log(printdata, 'printdata')
		if (printermodel === 'customk80') {
			await this.pk80.mzyyprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.mzyyprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.mzyyprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}
	//门诊挂号打印
	async mzghprint(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.mzghprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.mzghprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.mzghprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}

	//门诊预约挂号打印 补打
	async mzghprintBd(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.mzghprintBd(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.mzghprintBd(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.mzghprintBd(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}


	//门诊缴费打印
	async mzjsprint(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.mzjsprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.mzjsprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.mzjsprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}
	d
	//门诊缴费打印补打
	async mzjsprintBd(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.mzjsprintBd(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.mzjsprintBd(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.mzjsprintBd(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}


	//门诊充值打印
	async zyczprint(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.zyczprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.zyczprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.zyczprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}
	//门诊充值打印 补打
	async zyczprintBd(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.zyczprintBd(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.zyczprintBd(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.zyczprintBd(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}

	//自助取号打印
	async zzqhprint(printermodel, val, printdata) {
		if (printermodel === 'customk80') {
			await this.pk80.zzqhprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.zzqhprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.zzqhprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}

	//医技预约打印
	async yjyyprint(printermodel, val, printdata) {
		console.log(printermodel, 'printermodel')
		if (printermodel === 'customk80') {
			await this.pk80.yjyyprint(val, printdata);
		} else if (printermodel === 'siupoprint') {
			await this.psiupo.yjyyprint(val, printdata);
		} else if (printermodel === 'posprinter') {
			await this.ppos.yjyyprint(val, printdata);
		} else {
			MessageBox.alert("找不到名称为" + printermodel + "的打印机的机器");
		}
	}
}
// 通用讯谱打印机
export class Siupoprint {
	async zzfkprint(val, data) {
		console.log("开始打印讯谱" + '寻甸中医院自助机');
		//await this.printer.Open();
		const printer = new SiupoSlipPrinter();
		await printer.Reset();
		await printer.SetFontSize(2, 2);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		await printer.Print('电子健康卡');
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.Print('姓名:' + data.Name);
		await printer.Print('ID号:' + data.patientId);
		await printer.Print('');
		await printer.SetAlignType(1);
		await printer.PrintQR(7, data.qrcode+'',0);
		await printer.SetAlignType(0);
		await printer.Print('');
		await printer.Print(' 注  意 事 项：');
		await printer.Print('');
		await printer.Print('  该卡为实名制，请妥善保管,扫描凭条上二维码即可进行挂号、预约等。');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		//await this.printer.Close();
	}
	//门诊预约
	async mzyyprint(val, data) {
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new SiupoSlipPrinter();
		await printer.Open();
		await printer.Reset();
		await printer.SetFontSize(3, 3);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		await printer.Print('预约凭条');
		await printer.Print('');
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.SetFontSize(2, 2);
		await printer.Print('姓名:' + val.$store.state.user.userinfo.patientName);
		await printer.Print('');
		await printer.Print('ID号:' + val.$store.state.user.userinfo.patientId);
		await printer.Print('');
		// await this.printer.Print('预约ID:'+ this.appointmentInfo.regReciptId);
		// await printer.Print('就诊序号:' + data.queueNo);
		await printer.Print('');
		await printer.Print('预约科室:' + val.$store.state.appointment.appointmentInfo.data.deptName);
		await printer.Print('');
		await printer.Print('预约医生:' + val.$store.state.appointment.appointmentInfo.data.doctorName);
		await printer.Print('');
		await printer.Print('就诊日期:' + val.$store.state.appointment.appointmentInfo.data.regDate);
		await printer.Print('');
		await printer.Print('就诊时间:' + val.$store.state.appointment.appointmentInfo.data.regTime);
		await printer.Print('');
		await printer.Print('支付金额:' + val.$store.state.user.chargefee + '元');
		await printer.Print('');
		await printer.Print('支付方式:' + payinfo.payWay);
		await printer.Print('');
		await printer.Print('');
		await printer.SetFontSize(1, 1);
		await printer.Print('打印时间:' + printime);
		await printer.Print('');
		await printer.Print('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.Print('');
		await printer.Print('此凭条不做报销凭证。请妥善保管，遗失不补。');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		await printer.Close();
	}
	//门诊挂号
	async mzghprint(val, data) {
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		let payinfo = val.$store.state.payrecord.payinfo;
		const printer = new SiupoSlipPrinter();
		await printer.Open();
		await printer.Reset();
		await printer.SetFontSize(3, 3);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		await printer.Print('挂号凭条');
		await printer.Print('');
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.SetFontSize(2, 2);
		await printer.Print('姓名:' + val.$store.state.user.userinfo.patientName);
		await printer.Print('');
		await printer.Print('ID号:' + val.$store.state.user.userinfo.patientId);
		await printer.Print('');
		// await this.printer.Print('预约ID:'+ this.appointmentInfo.regReciptId);
		// await printer.Print('就诊序号:' + data.queueNo);
		await printer.Print('');
		await printer.Print('预约科室:' + val.$store.state.appointment.appointmentInfo.data.deptName);
		await printer.Print('');
		await printer.Print('预约医生:' + val.$store.state.appointment.appointmentInfo.data.doctorName);
		await printer.Print('');
		await printer.Print('就诊日期:' + val.$store.state.appointment.appointmentInfo.data.regDate);
		await printer.Print('');
		await printer.Print('就诊时间:' + val.$store.state.appointment.appointmentInfo.data.regTime);
		await printer.Print('');
		await printer.Print('支付金额:' + val.$store.state.user.chargefee + '元');
		await printer.Print('');
		await printer.Print('支付方式:' + payinfo.payWay);
		await printer.Print('');
		await printer.Print('');
		await printer.SetFontSize(1, 1);
		await printer.Print('打印时间:' + printime);
		await printer.Print('');
		await printer.Print('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.Print('');
		await printer.Print('此凭条不做报销凭证。请妥善保管，遗失不补。');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		await printer.Close();
	}
	//门诊缴费打印
	async mzjsprint(val, data) {
		//缴费流程
		let records = val.$store.state.recipel.records;
		let billinfo = val.$store.state.recipel.billinfo
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		let erCodeInfo = val.$store.state.recipel.erCodeInfo;

		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new SiupoSlipPrinter();
		await printer.Open();
		await printer.Reset();
		await printer.SetFontSize(3, 3);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		await printer.Print('门诊缴费凭条');
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.SetFontSize(2, 2);
		await printer.Print('姓名:' + userinfo.patientName);
		await printer.Print('');
		await printer.Print('ID号:' + userinfo.patientId);
		await printer.Print('');
		await printer.Print('总费用:' + records.amount);
		await printer.Print('');
		await printer.Print('');
		await printer.SetFontSize(1, 1);
		// await printer.Print('预约ID:'+  regReciptId);
		await printer.Print('结算流水号:' + erCodeInfo.payOrderId);
		await printer.Print('');
		// await printer.Print('执行科室:' + data.execDept);
		// await printer.Print('窗口号:' + data.dispensaryWindow);
		await printer.Print('就诊时间:' + records.prescDate);
		await printer.Print('');
		await printer.SetFontSize(2, 2);
		await printer.Print('------费用明细-------');
		await printer.Print('');
		for (let i of records.itemList) {
			await printer.Print('项目名称:' + i.itemName);
			await printer.Print('项目金额:' + i.itemPrice);
			await printer.Print('');
			// await printer.Print('项目数量:'+i.itemQty);
			// await printer.Print('项目单位:'+i.itemUnit);
		}
		var isYbPay = billinfo.settleType;
		// var payWay = payinfo.payWay;
		// console.log("是否医保=" + isYbPay + "支付方式=" + payWay);
		// if (parseInt(isYbPay)==1) {
		// 	payWay = "医保+" + payWay;
		// 	var ybpay = parseFloat(billinfo.totalFee) - parseFloat(billinfo.selfFee);
		// 	await printer.Print('医保支付:' + ybpay + '元');
		// 	await printer.Print('');
		// 	await printer.Print('个人支付:' + billinfo.selfFee + '元');
		// 	await printer.Print('');
		// }
		await printer.Print('费用总额:' + parseFloat(billinfo.totalFee) + '元');
		await printer.Print('');
		await printer.Print('现金支付:' + billinfo.selfFee + '元');
		await printer.Print('支付方式:' + payinfo.payWay);
		await printer.Print('');
		await printer.Print('');
		await printer.SetFontSize(1, 1);
		await printer.Print('支付凭证:' + payinfo.rcptNo);
		await printer.Print('');
		await printer.Print('打印时间:' + printime);
		await printer.Print('');
		await printer.Print('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.Print('');
		await printer.Print('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		await printer.Close();
	}
	//门诊充值打印
	async zyczprint(val, data) {
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		let billinfo = val.$store.state.recipel.billinfo
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new SiupoSlipPrinter();
		await printer.Open();
		await printer.Reset();
		await printer.SetFontSize(3, 3);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		await printer.Print('住院充值凭条');
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.SetFontSize(2, 2);
		await printer.Print('');
		await printer.Print('姓名:' + userinfo.patientName);
		await printer.Print('');
		await printer.Print('ID号:' + userinfo.patientId);
		await printer.Print('');
		// await printer.Print('预约ID:'+  regReciptId);
		//console.log("chargefee="+val.$store.state.user.chargefee);
		console.log("userpay=" + billinfo.totalFee);
		await printer.Print('充值金额:' + billinfo.totalFee + '元');
		await printer.Print('');
		await printer.Print('充值时间:' + printime);
		await printer.Print('');
		await printer.Print('充值后余额:1500元');
		await printer.Print('');
		await printer.Print('支付方式:' + payinfo.payWay);
		await printer.Print('');
		await printer.SetFontSize(1, 1);
		await printer.Print('支付凭证:' + payinfo.rcptNo);
		await printer.Print('');
		await printer.Print('打印时间:' + printime);
		await printer.Print('');
		await printer.Print('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.Print('');
		await printer.Print('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		await printer.Close();
	}

	//自助取号打印
	async zzqhprint(val, data) {
		let userinfo = val.$store.state.user.userinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new SiupoSlipPrinter();
		await printer.Open();
		await printer.Reset();
		await printer.SetFontSize(3, 3);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		await printer.Print('自助取号凭条');
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.SetFontSize(2, 2);
		await printer.Print('');
		await printer.Print('姓名:' + userinfo.patientName);
		await printer.Print('');
		await printer.Print('ID号:' + userinfo.patientId);
		await printer.Print('');
		for (let item of data.data) {
			await printer.Print(item.name + item.value);
			await printer.Print('');
		}
		await printer.Print('');
		await printer.Print('打印时间:' + printime);
		await printer.Print('');
		await printer.Print('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.Print('');
		await printer.Print('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		await printer.Close();
	}

	//医技预约打印
	async yjyyprint(val, data) {
		let userinfo = val.$store.state.user.userinfo;
		let printData = val.$store.state.yjyy.printData;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new SiupoSlipPrinter();
		await printer.Open();
		await printer.Reset();
		await printer.SetFontSize(3, 3);
		await printer.SetBold(true);
		await printer.SetLineSpace(1);
		await printer.SetAlignType(1);
		await printer.Print('寻甸中医院自助机');
		if (data.type == 0) {
			await printer.Print('医技预约凭条');
		} else if (data.type == 1) {
			await printer.Print('医技预约修改时间凭条');
		}
		await printer.Print('');
		await printer.SetAlignType(0);
		await printer.SetFontSize(2, 2);
		await printer.Print('');
		await printer.Print('姓名:' + userinfo.patientName);
		await printer.Print('');
		await printer.Print('ID号:' + userinfo.patientId);
		await printer.Print('');
		await printer.Print('项目名称:' + printData.itemName);
		await printer.Print('检查科室:' + printData.checkDept);
		await printer.Print('预约日期:' + printData.appointmentDate);
		await printer.Print('预约时间:' + printData.appointmentTime);
		if (data.type == 1) {
			await printer.Print('预约日期 旧:' + printData.appointmentDateOld);
			await printer.Print('预约时间 旧:' + printData.appointmentTimeOld);
		}
		await printer.Print('');
		await printer.Print('打印时间:' + printime);
		await printer.Print('');
		await printer.Print('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.Print('');
		await printer.Print('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		await printer.Print('');
		await printer.FeedLines(6 * 24);
		await printer.CutOff();
		await printer.Close();
	}

}
export class Posprint {
	async zzfkprint(val, data) {
		console.log("开始打印");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 12, true, 1);
		await printer.AppendStr('电子健康卡', 12, true, 1);
		await printer.AppendStr('姓名:' + data.Name, 10, true, 0);
		await printer.AppendStr('ID号:' + data.patientId, 10, true, 0);
		await printer.AppendQr(data.qrcode, 3, 1);
		await printer.AppendStr(' ', 10, true, 0);
		await printer.AppendStr(' 注  意 事 项：', 10, true, 0);
		await printer.AppendStr('  该卡为实名制，请妥善保管,扫描凭条上二维码即可进行挂号、预约等。', 10, true, 0);
		await printer.Print(data.name);
		console.log("打印结束");
		//await this.printer.Close();
	}

	async mzyyprint(val, data) {
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 11, true, 1);
		await printer.AppendStr('预约凭条', 11, true, 1);
		await printer.AppendStr('姓名:' + val.$store.state.user.userinfo.patientName, 10, true, 0);
		await printer.AppendStr('ID号:' + val.$store.state.user.userinfo.patientId, 10, true, 0);
		// await this.printer.Print('预约ID:'+ this.appointmentInfo.regReciptId);
		// await printer.AppendStr('就诊序号:' + data.queueNo, 10, true, 0);
		await printer.AppendStr('预约科室:' + val.$store.state.appointment.appointmentInfo.data.deptName, 10, true, 0);
		await printer.AppendStr('预约医生:' + val.$store.state.appointment.appointmentInfo.data.doctorName, 10, true,
			0);
		await printer.AppendStr('就诊日期:' + val.$store.state.appointment.appointmentInfo.data.regDate, 10, true, 0);
		await printer.AppendStr('就诊时间:' + val.$store.state.appointment.appointmentInfo.data.regTime, 10, true, 0);
		await printer.AppendStr('支付金额:' + val.$store.state.user.chargefee + '元', 10, true, 0);
		await printer.AppendStr('支付方式:' + val.$store.state.payrecord.payinfo.payWay, 10, true, 0);
		await printer.AppendStr('打印时间:' + printime, 10, true, 0);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId, 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('此凭条不做报销凭证。请妥善保管，遗失不补。', 10, true, 0);
		await printer.Print(data.name);
	}
	async mzghprint(val, data) {
		let appointmentInfo = val.$store.state.appointment.appointmentInfo;
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 11, true, 1);
		await printer.AppendStr('挂号凭条', 11, true, 1);
		await printer.AppendStr('', 10, true, 1);
		await printer.AppendStr('姓名:' + val.$store.state.user.userinfo.patientName, 10, true, 0);
		await printer.AppendStr('ID号:' + val.$store.state.user.userinfo.patientId, 10, true, 0);
		// await printer.Print('预约ID:'+  regReciptId);
		await printer.AppendStr('预约科室:' + val.$store.state.appointment.appointmentInfo.data.deptName, 10, true, 0);
		await printer.AppendStr('预约医生:' + val.$store.state.appointment.appointmentInfo.data.doctorName, 10, true,
			0);
		await printer.AppendStr('就诊日期:' + val.$store.state.appointment.appointmentInfo.data.regDate, 10, true, 0);
		await printer.AppendStr('就诊时间:' + val.$store.state.appointment.appointmentInfo.data.regTime, 10, true, 0);
		await printer.AppendStr('支付金额:' + val.$store.state.user.chargefee + '元', 10, true, 0);
		await printer.AppendStr('支付方式:' + val.$store.state.payrecord.payinfo.payWay, 10, true, 0);
		await printer.AppendStr('打印时间:' + printime, 10, true, 0);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId, 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('此凭条不做报销凭证。请妥善保管，遗失不补。', 10, true, 0);
		await printer.Print(data.name);
	}
	async mzjsprint(val, data) {
		let records = val.$store.state.recipel.records;
		let billinfo = val.$store.state.recipel.billinfo
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		let erCodeInfo = val.$store.state.recipel.erCodeInfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 11, true, 1);
		await printer.AppendStr('门诊缴费凭条', 11, true, 1);
		await printer.AppendStr('', 11, true, 1);
		await printer.AppendStr('姓名:' + userinfo.patientName, 10, true, 0);
		await printer.AppendStr('ID号:' + userinfo.patientId, 10, true, 0);
		// await printer.Print('预约ID:'+  regReciptId);
		await printer.AppendStr('结算流水号:' + erCodeInfo.payOrderId, 10, true, 0);
		// await printer.AppendStr('执行科室:' + data.execDept, 10, true, 0);
		// await printer.AppendStr('窗口号:' + data.dispensaryWindow, 10, true, 0);
		await printer.AppendStr('就诊时间:' + records.prescDate, 10, true, 0);
		await printer.AppendStr('------费用明细-------', 10, true, 0);
		for (let i of records.itemList) {
			await printer.AppendStr('项目名称:' + i.itemName, 10, true, 0);
			await printer.AppendStr('项目金额:' + i.itemPrice, 10, true, 0);
			// await printer.AppendStr('项目数量:'+i.itemQty,10,true,0);
			// await printer.AppendStr('项目单位:'+i.itemUnit,10,true,0);
		}
		await printer.AppendStr('总费用:' + records.amount, 10, true, 0);
		await printer.AppendStr('现金支付:' + billinfo.selfFee + '元', 10, true, 0);
		await printer.AppendStr('支付方式:' + payinfo.payWay, 10, true, 0);
		await printer.AppendStr('支付凭证:' + payinfo.rcptNo, 10, true, 0);
		await printer.AppendStr('打印时间:' + printime, 10, true, 0);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId, 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补', 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.Print(data.name);
	}

	async zyczprint(val, data) {
		console.log("住院充值壁挂打印开始");
		let billinfo = val.$store.state.recipel.billinfo
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 10, true, 1);
		await printer.AppendStr('住院充值凭条', 10, true, 1);
		await printer.AppendStr('', 10, true, 1);
		await printer.AppendStr('姓名:' + userinfo.patientName, 10, true, 0);
		await printer.AppendStr('ID号:' + userinfo.patientId, 10, true, 0);
		// await printer.Print('预约ID:'+  regReciptId);
		console.log("住院充值壁挂userpay=" + val.$store.state.user.userpay);
		await printer.AppendStr('充值金额:' + billinfo.totalFee, 10, true, 0);
		await printer.AppendStr('充值时间:' + printime, 10, true, 0);
		await printer.AppendStr(printime, 10, true, 0);
		await printer.AppendStr('充值后余额:' + data.balance, 10, true, 0);
		await printer.AppendStr('支付金额:' + val.$store.state.user.chargefee + '元', 10, true, 0);
		await printer.AppendStr('支付方式:' + val.$store.state.payrecord.payinfo.payWay, 10, true, 0);
		await printer.AppendStr('支付流水号:', 10, true, 0);
		await printer.AppendStr(payinfo.rcptNo, 10, true, 0);
		await printer.AppendStr('打印时间:' + printime, 10, true, 0);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId, 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补', 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.Print(data.name);
		console.log("住院充值壁挂打印结束");

	}

	async zzqhprint(val, data) {
		let userinfo = val.$store.state.user.userinfo;
		console.log("自助取号壁挂打印开始");
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 10, true, 1);
		await printer.AppendStr('自助取号凭条', 10, true, 1);
		await printer.AppendStr('', 10, true, 1);
		await printer.AppendStr('姓名:' + userinfo.patientName, 10, true, 0);
		await printer.AppendStr('ID号:' + userinfo.patientId, 10, true, 0);
		// await printer.Print('预约ID:'+  regReciptId);
		for (let item of data.data) {
			await printer.AppendStr(item.name + item.value, 10, true, 0);
		}
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('打印时间:' + printime, 10, true, 0);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId, 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补', 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.Print(data.name);
		console.log("住院充值壁挂打印结束");
	}

	async yjyyprint(val, data) {
		let userinfo = val.$store.state.user.userinfo;
		let printData = val.$store.state.yjyy.printData;
		console.log("医技预约壁挂打印开始");
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new PosPrinter();
		await printer.AppendStr('寻甸中医院自助机', 10, true, 1);
		if (data.type == 0) {
			await printer.AppendStr('医技预约凭条', 10, true, 1);
		} else if (data.type == 1) {
			await printer.AppendStr('医技预约修改时间凭条', 10, true, 1);
		}
		await printer.AppendStr('', 10, true, 1);
		await printer.AppendStr('姓名:' + userinfo.patientName, 10, true, 0);
		await printer.AppendStr('ID号:' + userinfo.patientId, 10, true, 0);
		await printer.AppendStr('项目名称:' + printData.itemName, 10, true, 0);
		await printer.AppendStr('检查科室:' + printData.checkDept, 10, true, 0);
		await printer.AppendStr('预约日期:' + printData.appointmentDate, 10, true, 0);
		await printer.AppendStr('预约时间:' + printData.appointmentTime, 10, true, 0);
		if (data.type == 1) {
			await printer.AppendStr('预约日期 旧:' + printData.appointmentDateOld, 10, true, 0);
			await printer.AppendStr('预约时间 旧:' + printData.appointmentTimeOld, 10, true, 0);
		}
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('打印时间:' + printime, 10, true, 0);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId, 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补', 10, true, 0);
		await printer.AppendStr('', 10, true, 0);
		await printer.Print(data.name);
		console.log("医技预约打印结束");
	}
}
export class k80print {
	async zzfkprint(val, data) {
		console.log("k80开始打印");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.SetMode(2);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		await printer.AppendStr('电子健康卡');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.SetMode(1);
		await printer.AppendStr('  姓名:' + data.Name);
		await printer.AppendStr('  ID号:' + data.patientId);
		await printer.AppendStr('');
		await printer.SetMode(1);
		await printer.Setweizhi("Center");
		await printer.PrintQR(data.qrcode+'',0);
		await printer.Setweizhi("left");
		await printer.SetMode(1);
		await printer.AppendStr('');
		await printer.AppendStr('  注  意 事 项：');
		await printer.AppendStr('');
		await printer.AppendStr('  该卡为实名制,请妥善保管,扫描凭条上二维码即可进行挂号、预约等。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}

	async mzyyprint(val, data) {
		let regDetailVo = val.$store.state.appointment.appointmentInfo.regDetailVo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('' + '寻甸中医院自助机');
		await printer.AppendStr('预约/挂号凭条');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.Setweizhi("Center");
		await printer.PrintQR(data.hisVisitNo+'',1);
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.selectCharacterSize(10); //延吉需要
		await printer.AppendStr('  姓名:' + val.$store.state.user.userinfo.patientName);
		await printer.AppendStr('  ID号:' + val.$store.state.user.userinfo.patientId);
		await printer.AppendStr('  就诊序号:' + val.$store.state.appointment.appointmentInfo.queueNo);
		await printer.AppendStr('  门诊号:' + data.hisVisitNo);
		await printer.AppendStr('  预约科室:' + regDetailVo.deptName);
		await printer.AppendStr('  预约医生:' + regDetailVo.doctorName);
		await printer.AppendStr('  预约日期:' + regDetailVo.regDate);
		await printer.AppendStr('  预约时间:' + regDetailVo.regTime);
		var payWay = payinfo.payWay;
		if (payWay === 'wx') {
			payWay = '微信支付';
		} else if (payWay === 'ali') {
			payWay = '支付宝支付';
		}
		await printer.AppendStr('  支付方式:' + payWay);
		await printer.AppendStr('  支付金额:' + regDetailVo.selfFee + '元');
		await printer.AppendStr('  支付流水号:' + payinfo.payOrderId);
		await printer.AppendStr('');
		await printer.AppendStr('  打印时间:' + printime);
		await printer.AppendStr('  终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		await printer.AppendStr('  如需开具发票，请持此凭条到门诊一楼收款室窗口！');
		await printer.AppendStr('  此凭条不做报销凭证。');
		await printer.AppendStr('  请妥善保管，遗失不补。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();

	}
	async mzghprint(val, data) {
		//打印数据
		let reData = data.data;
		let regDetailVo = val.$store.state.appointment.appointmentInfo.regDetailVo;
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		console.log("val.$store.state.appointment.appointmentInfo",val.$store.state.appointment.appointmentInfo);
		localStorage.setItem("appointmentInfo",JSON.stringify(val.$store.state.appointment.appointmentInfo))
		localStorage.setItem("reData",JSON.stringify(reData))
		localStorage.setItem("data",JSON.stringify(data))
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('' + '寻甸中医院自助机');
		await printer.AppendStr('预约/挂号凭条');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.Setweizhi("Center");
		await printer.PrintQR(data.hisVisitNo,1);
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.selectCharacterSize(10);
		await printer.AppendStr('  ID号:' + userinfo.patientId);
		await printer.selectCharacterSize(0);
		await printer.AppendStr('  姓名:' + userinfo.patientName);
		await printer.AppendStr('    ------------------');
		await printer.AppendStr('  就诊序号:' + val.$store.state.appointment.appointmentInfo.queueNo);
		await printer.AppendStr('  预约科室:' + regDetailVo.deptName);
		await printer.AppendStr('  预约医生:' + regDetailVo.doctorName);
		await printer.AppendStr('  门诊号:' + data.hisVisitNo);
		await printer.AppendStr('  就诊日期:' + regDetailVo.regDate);
		var isYbPay = val.$store.state.user.isYbPay;
		var zhuanghuzf = val.$store.state.user.ybpay;
		var payWay = payinfo.payWay;
		if (payWay === 'wx') {
			payWay = '微信支付';
		} else if (payWay === 'ali') {
			payWay = '支付宝支付';
		}
		await printer.AppendStr('  支付方式:' + payWay);
		await printer.AppendStr('  支付金额:' + regDetailVo.totalFee + '元');
		await printer.AppendStr('  支付流水号:' + payinfo.payOrderId);
		await printer.AppendStr('');
		await printer.AppendStr('  打印时间:' + printime);
		await printer.AppendStr('  终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		await printer.AppendStr('  如需开具发票，请持此凭条到门诊一楼收款室窗口！');
		await printer.AppendStr('  此凭条不做报销凭证。');
		await printer.AppendStr('  请妥善保管，遗失不补。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}

	//预约挂号补打
	async mzghprintBd(val, data) {
		//打印数据
		let reData = data.data;
		console.log('打印数据',reData);
		localStorage.setItem("reData",reData);
		let userinfo = val.$store.state.user.userinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('' + '寻甸中医院自助机');
		await printer.AppendStr('预约/挂号凭条');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.Setweizhi("Center");
		await printer.PrintQR(reData.hisVisitNo+'',1); //九台、延吉
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.selectCharacterSize(10); //延吉需要
		await printer.AppendStr('  ID号:' + userinfo.patientId); //九台、延吉
		// await printer.AppendStr('  预约科室:' + reData.deptText); //九台、延吉
		await printer.selectCharacterSize(0); //延吉需要
		await printer.AppendStr('  姓名:' + userinfo.patientName);
		await printer.AppendStr('    ------------------');
		await printer.AppendStr('  就诊序号:' + reData.queueNo); //集安不需要,延吉九台需要
		await printer.AppendStr('  预约科室:' + reData.deptText); //九台、延吉
		await printer.AppendStr('  预约医生:' + reData.doctorName);
		await printer.AppendStr('  门诊号:' + reData.hisVisitNo);
		await printer.AppendStr('  就诊日期:' + reData.settleDate);
		await printer.AppendStr('  支付方式:' + reData.payWayText);
		await printer.AppendStr('  支付金额:' + reData.totalFee + '元');
		await printer.AppendStr('  支付流水号:' + reData.payOrderId);
		await printer.AppendStr('');
		await printer.AppendStr('  打印时间:' + printime);
		await printer.AppendStr('  终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		await printer.AppendStr('  如需开具发票，请持此凭条到门诊一楼收款室窗口！');
		await printer.AppendStr('  此凭条不做报销凭证。');
		await printer.AppendStr('  请妥善保管，遗失不补。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}



	async mzjsprint(val, data) {
		var isYbPay = val.$store.state.user.isYbPay;
		//打印数据
		let reData = data.data;
		let records = val.$store.state.recipel.records;
		// let drugList = val.$store.state.recipel.records.drugList
		let paidOrdersSuccessByMzjfRes = val.$store.state.recipel.records.paidOrdersSuccessByMzjfRes;
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		// console.log('drugList', drugList);
		console.log('paidOrdersSuccessByMzjfRes', paidOrdersSuccessByMzjfRes);
		const printer = new CK80Printer();
		console.log("开始打印...",printer);
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		await printer.AppendStr('门诊缴费凭条');
		await printer.Setweizhi("left");
		await printer.AppendStr('');
		////--集安
		await printer.Setweizhi("Center");
		console.log("患者费别是否医保",isYbPay);
		if (isYbPay) {
			await printer.PrintQR(paidOrdersSuccessByMzjfRes.hisVisitNo+'',0); //九台、延吉
		} else {
			await printer.PrintQR(paidOrdersSuccessByMzjfRes.hisBillNo+'',0); //九台、延吉
		}
		await printer.Setweizhi("left");
		////--集安
		await printer.SetLines(2);
		if (isYbPay) {
			await printer.AppendStr('    门诊号:' + paidOrdersSuccessByMzjfRes.hisVisitNo);
		} else {
			await printer.AppendStr('    门诊号:' + paidOrdersSuccessByMzjfRes.hisBillNo);
		}
		await printer.AppendStr('    ID号:' + userinfo.patientId); //延吉和九台取值
		await printer.selectCharacterSize(0);
		await printer.AppendStr('    姓名:' + userinfo.patientName);
		if (isYbPay) {
			await printer.AppendStr('    总费用:' + val.$store.state.user.userAllPay);
		} else {
			await printer.AppendStr('    总费用:' + records.amount);
		}
		await printer.AppendStr('    处方时间:' + records.prescDate);
		// await printer.AppendStr('             ------费用明细-------');
		// if (drugList != undefined && drugList) {
		// 	for (let i of drugList) {
		// 		await printer.AppendStr('    项目名称:' + i.itemName);
		// 		await printer.AppendStr('    项目单价:' + i.itemPrice);
		// 		await printer.Print('项目数量:' + i.amount);
		// 		await printer.Print('项目单位:' + i.packageUnit);
		// 		await printer.Print('项目总金额:' + i.itemTotalPrice);
		// 	}
		// }

		var zhuanghuzf = val.$store.state.user.ybpay;
		console.log('是否医保支付',isYbPay)
		if (isYbPay) {
			var ybzhye = val.$store.state.user.ybzhye;
			console.log("账户余额=" + ybzhye);
			var ybpay = val.$store.state.user.ybzhye;
			await printer.AppendStr('    ---------------------------------');
			await printer.AppendStr('    医保卡支付:' + zhuanghuzf + '元');
			await printer.AppendStr('    个人现金支付:' + val.$store.state.user.userpay + '元');
			await printer.AppendStr('    ----------------------------------');
			await printer.AppendStr('    医保账户余额' + ybzhye);
		}
		if (isYbPay && val.$store.state.user.userpay == 0) {
			await printer.AppendStr('    支付方式:医保支付');
		} else if (isYbPay && val.$store.state.user.userpay != 0){
			await printer.AppendStr('    支付方式:医保支付+自费支付');
		}else{
			await printer.AppendStr('    支付方式:' + payinfo.payWay);
		}
		if (paidOrdersSuccessByMzjfRes.receiptNum) {
			await printer.AppendStr('    支付流水号:' + paidOrdersSuccessByMzjfRes.receiptNum);
		}
		await printer.AppendStr('');
		await printer.AppendStr('    打印时间:' + printime);
		await printer.AppendStr('    终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		await printer.AppendStr('    如需开具发票，请持此凭条到门诊一楼收款室窗口！');
		await printer.AppendStr('    此凭条不做报销凭证。');
		await printer.AppendStr('    请妥善保管，遗失不补。');

		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}

	//门诊结算补打
	async mzjsprintBd(val, data) {
		//打印数据
		let reData = data.data;
		let userinfo = val.$store.state.user.userinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		await printer.AppendStr('门诊缴费凭条');
		await printer.Setweizhi("left");
		await printer.AppendStr('');
		////--集安
		await printer.Setweizhi("Right");
		await printer.SetLines(1);
		// await printer.AppendStr('    门诊号:' + reData.hisBillNo);
		await printer.PrintQR((reData.invoiceUrl+'')==''?reData.hisBillNo+'':reData.invoiceUrl,0); //九台、延吉
		await printer.Setweizhi("left");
		////--集安
		await printer.Setweizhi("Center");
		await printer.SetLines(2);
		await printer.AppendStr('    门诊号:' + reData.hisBillNo);
		await printer.AppendStr('    ID号:' + userinfo.patientId); //延吉和九台取值
		await printer.selectCharacterSize(0);
		await printer.AppendStr('    姓名:' + userinfo.patientName);
		await printer.AppendStr('    总费用:' + reData.totalFee);
		await printer.AppendStr('    处方时间:' + reData.settleDate);
		await printer.AppendStr('    支付方式:' + reData.payWayText);
		await printer.AppendStr('    支付流水号:' + reData.payOrderId);
		await printer.AppendStr('');
		await printer.AppendStr('    打印时间:' + printime);
		await printer.AppendStr('    终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		await printer.AppendStr('    如需开具发票，请持此凭条到门诊一楼收款室窗口！');
		await printer.AppendStr('    此凭条不做报销凭证。');
		await printer.AppendStr('    请妥善保管，遗失不补。');

		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}



	async zyczprint(val, data) {
		//打印数据
		let reData = data.data;
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		await printer.AppendStr('住院充值凭条');
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.selectCharacterSize(0);
		await printer.AppendStr('  姓名:' + userinfo.patientName);
		await printer.AppendStr('  住院号:' + userinfo.inpatientId);
		// await printer.Print('预约ID:'+  regReciptId);
		console.log("住院K80充值userpay=" + val.$store.state.recipel.records.amount);
		await printer.AppendStr('  充值金额:' + val.$store.state.recipel.records.amount);
		await printer.AppendStr('  充值时间:' + printime);
		if (val.$store.state.recipel.records.yjjRes) {
			await printer.AppendStr('  充值后余额:' + val.$store.state.recipel.records.yjjRes.balance);
		}
		var payWay = payinfo.payWay;
		var czlsh = payinfo.rcptNo;
		if (payWay === 'wx') {
			payWay = '微信支付';
			czlsh = payinfo.rcptNo;
		} else if (payWay === 'ali') {
			payWay = '支付宝支付';
			czlsh = payinfo.transNo;
		}
		await printer.AppendStr('  支付方式:' + payWay);

		await printer.AppendStr('  支付流水号:' + val.$store.state.recipel.erCodeInfo.payOrderId);
		await printer.AppendStr('');
		await printer.AppendStr('  打印时间:' + printime);
		await printer.AppendStr('  终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		//延吉、九台的
		//await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		//集安的
		await printer.AppendStr('  请于明日，持本凭条到住院窗口领取缴费凭证。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}

	//住院充值补打
	async zyczprintBd(val, data) {
		//打印数据
		let reData = data.data;
		let userinfo = val.$store.state.user.userinfo;
		let payinfo = val.$store.state.payrecord.payinfo;
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		await printer.AppendStr('住院充值凭条');
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.selectCharacterSize(0);
		await printer.AppendStr('  姓名:' + userinfo.patientName);
		await printer.AppendStr('  住院号:' + userinfo.inpatientId);
		await printer.AppendStr('  充值金额:' + reData.totalFee);
		await printer.AppendStr('  充值时间:' + reData.modifyTime);
		// await printer.AppendStr('  充值后余额:' + reData.balance);
		var payWay = payinfo.payWay;
		var czlsh = payinfo.rcptNo;
		if (payWay === 'wx') {
			payWay = '微信支付';
			czlsh = payinfo.rcptNo;
		} else if (payWay === 'ali') {
			payWay = '支付宝支付';
			czlsh = payinfo.transNo;
		}
		await printer.AppendStr('  支付方式:' + reData.payWayText);

		await printer.AppendStr('  支付流水号:' + reData.payOrderId);
		await printer.AppendStr('');
		await printer.AppendStr('  打印时间:' + printime);
		await printer.AppendStr('  终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		//延吉、九台的
		//await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		//集安的
		await printer.AppendStr('  请于明日，持本凭条到住院窗口领取缴费凭证。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}

	async zzqhprint(val, data) {
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		await printer.AppendStr('自助取号凭条');
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.selectCharacterSize(0);
		await printer.AppendStr('  姓名:' + userinfo.name);
		await printer.AppendStr('  住院号:' + userinfo.patientId);
		for (let item of data.data) {
			await printer.AppendStr(item.name + item.value);
		}
		await printer.AppendStr('');
		await printer.AppendStr('  打印时间:' + printime);
		await printer.AppendStr('  终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		//延吉、九台的
		//await printer.AppendStr('此凭条不做报销凭证，如需开具发票，请持此凭条到门诊二楼收款室7号窗口！请妥善保管，遗失不补');
		//集安的
		await printer.AppendStr('  请于明日，持本凭条到住院窗口领取缴费凭证。');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}

	async yjyyprint(val, data) {
		let userinfo = val.$store.state.user.userinfo;
		let printData = val.$store.state.yjyy.printData;
		console.log("医技预约壁挂打印开始");
		var printime = moment().format("YYYY-MM-DD HH:mm:SS");
		const printer = new CK80Printer();
		await printer.Open();
		await printer.selectCharacterSize(17);
		await printer.Setweizhi("Center");
		await printer.AppendStr('寻甸中医院自助机');
		if (data.type == 0) {
			await printer.AppendStr('医技预约凭条');
		} else if (data.type == 1) {
			await printer.AppendStr('医技预约修改时间凭条');
		}
		await printer.AppendStr('');
		await printer.Setweizhi("left");
		await printer.SetLines(2);
		await printer.AppendStr('姓名:' + userinfo.patientName);
		await printer.AppendStr('ID号:' + userinfo.patientId);
		await printer.AppendStr('项目名称:' + printData.itemName);
		await printer.AppendStr('检查科室:' + printData.checkDept);
		await printer.AppendStr('预约日期:' + printData.appointmentDate);
		await printer.AppendStr('预约时间:' + printData.appointmentTime);
		if (data.type == 1) {
			await printer.AppendStr('预约日期 旧:' + printData.appointmentDateOld);
			await printer.AppendStr('预约时间 旧:' + printData.appointmentTimeOld);
		}
		await printer.AppendStr('');
		await printer.AppendStr('打印时间:' + printime);
		await printer.AppendStr('终端编号:' + val.$store.state.terminfo.terminfo.termId);
		await printer.AppendStr('');
		await printer.AppendStr('');
		await printer.CutOff();
		await printer.Close();
	}
}
